package com.zp.self.module.工具.rpc远程访问.forest.rpcInterface;

import com.dtflys.forest.annotation.Request;
import com.zp.self.module.简单的login.Person;
/**
*  forest的熟悉,
*  参考：https://www.cnblogs.com/bryan31/p/13359376.html
 *  官方：http://forest.dtflyx.com/docs/
 *
 *  重点：
 *  1.支持模板表达式--占位符 http://127.0.0.1:8800/date/get?name=${1}
 *      也可以注解指定：@DataVariable("name") String name,
 *      也可以直接写成：@DataVariable("name") String name,
 *  2.参数绑定到header和body里去，你甚至于可以用一些表达式简单的把对象序列化成json或者xml：
 *
 *  3.对https单双向证书的支持
 *
 *  4.跨系统对接用forest,SpringCloud 还是feign
* @author  ZengPeng
* @date  22:53
**/
public interface RpcTestService {

    //1.支持模板表达式--占位符
    @Request(url = "http://127.0.0.1:8800/date/get?un=${1}")
    String getRequest(String name);

    //2.参数绑定到header和body里去，
    @Request(
            url = "${base}/pay",
            contentType = "application/json",
            type = "post",
            dataType = "json",
            headers = {"Authorization: ${1}"},
            data = "${json($0)}"
    )
    public Object pay(Person request, String auth);

    // 3.对https单双向证书的支持
    @Request(
            url = "${base}/pay",
            contentType = "application/json",
            type = "post",
            dataType = "json",
            keyStore = "pay-keystore",
            data = "${json($0)}"
    )
    public Object pay(Person request);
    //其中pay-keystore对应着application.yml里的ssl-key-stores
    //forest:
    //  ...
    //  ssl-key-stores:
    //    - id: pay-keystore
    //      file: test.keystore
    //      keystore-pass: 123456
    //      cert-pass: 123456
    //      protocols: SSLv3

}
